Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 'getClassLoader' Exception in AD Collector initialization #474

Merged
merged 5 commits into from
May 31, 2023

Conversation

khushbr
Copy link
Collaborator

@khushbr khushbr commented May 31, 2023

Is your feature request related to a problem? Please provide an existing Issue # , or describe.
Fix below error in cluster spinning up with PA plugin:

org.opensearch.bootstrap.StartupException: java.lang.IllegalStateException: failed to load plugin class [org.opensearch.performanceanalyzer.PerformanceAnalyzerPlugin]
»  	at org.opensearch.bootstrap.OpenSearch.init(OpenSearch.java:184) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»  	at org.opensearch.bootstrap.OpenSearch.execute(OpenSearch.java:171) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»  	at org.opensearch.cli.EnvironmentAwareCommand.execute(EnvironmentAwareCommand.java:104) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»  	at org.opensearch.cli.Command.mainWithoutErrorHandling(Command.java:138) ~[opensearch-cli-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»  	at org.opensearch.cli.Command.main(Command.java:101) ~[opensearch-cli-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»  	at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:137) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»  	at org.opensearch.bootstrap.OpenSearch.main(OpenSearch.java:103) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
»  Caused by: java.lang.IllegalStateException: failed to load plugin class [org.opensearch.performanceanalyzer.PerformanceAnalyzerPlugin]
»  	at org.opensearch.plugins.PluginsService.loadPlugin(PluginsService.java:791) ~[opensearch-3.0.0-SNAPSHOT.jar:3.0.0-SNAPSHOT]
...
  Caused by: java.security.AccessControlException: access denied ("java.lang.RuntimePermission" "getClassLoader")
»  	at java.security.AccessControlContext.checkPermission(AccessControlContext.java:472) ~[?:?]
»  	at java.security.AccessController.checkPermission(AccessController.java:897) ~[?:?]
»  	at java.lang.SecurityManager.checkPermission(SecurityManager.java:322) ~[?:?]
»  	at java.lang.ClassLoader.checkClassLoaderPermission(ClassLoader.java:2060) ~[?:?]
»  	at java.lang.ClassLoader.getParent(ClassLoader.java:1806) ~[?:?]
»  	at org.opensearch.performanceanalyzer.collectors.AdmissionControlMetricsCollector.canLoadAdmissionControllerClasses(AdmissionControlMetricsCollector.java:179) ~[?:?]

Check List

  • New functionality includes testing.
    • All tests pass
  • New functionality has been documented.
    • New functionality has javadoc added
  • Commits are signed per the DCO using --signoff

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
For more information on following Developer Certificate of Origin and signing off your commits, please check here.

@codecov
Copy link

codecov bot commented May 31, 2023

Codecov Report

Merging #474 (ddb9db5) into main (a6419a9) will decrease coverage by 0.17%.
The diff coverage is 100.00%.

❗ Current head ddb9db5 differs from pull request most recent head cb3be1b. Consider uploading reports for the commit cb3be1b to get more accurate results

@@             Coverage Diff              @@
##               main     #474      +/-   ##
============================================
- Coverage     73.67%   73.51%   -0.17%     
+ Complexity      375      374       -1     
============================================
  Files            44       44              
  Lines          2477     2477              
  Branches        172      172              
============================================
- Hits           1825     1821       -4     
- Misses          544      547       +3     
- Partials        108      109       +1     
Impacted Files Coverage Δ
...r/collectors/AdmissionControlMetricsCollector.java 17.14% <100.00%> (ø)

... and 1 file with indirect coverage changes

@khushbr khushbr merged commit 5428a52 into opensearch-project:main May 31, 2023
7 of 9 checks passed
@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.x failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.x 2.x
# Navigate to the new working tree
cd .worktrees/backport-2.x
# Create a new branch
git switch --create backport/backport-474-to-2.x
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5428a528e70032cb7a0a92b5eeec8cc45fb0d2cf
# Push it to GitHub
git push --set-upstream origin backport/backport-474-to-2.x
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.x

Then, create a pull request where the base branch is 2.x and the compare/head branch is backport/backport-474-to-2.x.

@opensearch-trigger-bot
Copy link
Contributor

The backport to 2.8 failed:

The process '/usr/bin/git' failed with exit code 1

To backport manually, run these commands in your terminal:

# Fetch latest updates from GitHub
git fetch
# Create a new working tree
git worktree add .worktrees/backport-2.8 2.8
# Navigate to the new working tree
cd .worktrees/backport-2.8
# Create a new branch
git switch --create backport/backport-474-to-2.8
# Cherry-pick the merged commit of this pull request and resolve the conflicts
git cherry-pick -x --mainline 1 5428a528e70032cb7a0a92b5eeec8cc45fb0d2cf
# Push it to GitHub
git push --set-upstream origin backport/backport-474-to-2.8
# Go back to the original working tree
cd ../..
# Delete the working tree
git worktree remove .worktrees/backport-2.8

Then, create a pull request where the base branch is 2.8 and the compare/head branch is backport/backport-474-to-2.8.

khushbr added a commit to khushbr/performance-analyzer that referenced this pull request May 31, 2023
…arch-project#474)

* Fix SHA update for PA-Commons repo in build.gradle

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>

* Adding getClassLoader permission

* Addressing failure in AdmissionControlMetricsCollector initialization

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>

* Adding getClassLoader for AdmissionControl Collector

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>

---------

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>
khushbr added a commit to khushbr/performance-analyzer that referenced this pull request May 31, 2023
…arch-project#474)

* Fix SHA update for PA-Commons repo in build.gradle

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>

* Adding getClassLoader permission

* Addressing failure in AdmissionControlMetricsCollector initialization

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>

* Adding getClassLoader for AdmissionControl Collector

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>

---------

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>
khushbr added a commit that referenced this pull request May 31, 2023
…475)

* Fix SHA update for PA-Commons repo in build.gradle



* Adding getClassLoader permission

* Addressing failure in AdmissionControlMetricsCollector initialization



* Adding getClassLoader for AdmissionControl Collector



---------

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>
ansjcy pushed a commit that referenced this pull request May 31, 2023
…476)

* Fix SHA update for PA-Commons repo in build.gradle



* Adding getClassLoader permission

* Addressing failure in AdmissionControlMetricsCollector initialization



* Adding getClassLoader for AdmissionControl Collector



---------

Signed-off-by: Khushboo Rajput <khushbr@amazon.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants